<?xml version="1.0" encoding="utf-8" ?>
<!--
/* **********************************************************************************
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* This source code is subject to terms and conditions of the Shared Source License
* for DSL Editor PowerToy. A copy of the license can be found in the License.htm file
* at the root of this distribution. If you can not locate the Shared Source License
* for DSL Editor PowerToy, please obtain a copy from: http://www.codeplex.com/dsltreegrideditor/Project/License.aspx.
* By using this source code in any fashion, you are agreeing to be bound by
* the terms of the Shared Source License for DSL Editor PowerToy.
*
* You must not remove this notice, or any other, from this software.
*
* **********************************************************************************/
-->
<Actions xmlns="http://schemas.microsoft.com/pag/gax-core" xmlns:xi="http://www.w3.org/2001/XInclude">
  <!-- Unregister package runtime information -->
  <Action Name="TraceCleanup1" Type="WriteTraceAction" Pane="Package" Message="Unregistering DSL package"/>
  <Action Name="UnregisterPackage" Type="RegisterVsPackageProjectAction"
          Action="Unregister">
    <Input Name="PackageProject" RecipeArgument="DslPackageProject" />
  </Action>

  <!-- Remove Dependency Project References -->
  <Action Name="TraceCleanup2" Type="WriteTraceAction" Pane="Package" Message="Removing assembly references"/>
  <Action Name="RemoveAssemblyReferences" Type="RemoveAssembliesReferenceAction"
          FileNames="DslEditorPowerToy.Languages.Common;DslEditorPowerToy.Controls.Common;DslEditorPowerToy.Controls.Languages;DslEditorPowerToy.Controls.Editors">
    <Input Name="ReferringProject" RecipeArgument="DslPackageProject" />
  </Action>
  
  <!-- Remove existing artefacts in Destination Folders (cleanup) -->
  <Action Name="TraceCleanup31" Type="WriteTraceAction" Pane="Package" Message="Removing added files from folder: '$(FullDestFolderPath)'"/>
  <Action Name="CleanupDestFolderPath" Type="DeleteProjectItemsAction"
          FileNames="DslEditorsDefinition.deptec">
    <Input Name="FolderPath" RecipeArgument="FullDestFolderPath" />
    <Input Name="ReferringProject" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="TraceCleanup32" Type="WriteTraceAction" Pane="Package" Message="Removing added files from folder: '$(GeneratedCodeFolderPath)'"/>
  <Action Name="CleanupGeneratedCodeFolderPath" Type="DeleteProjectItemsAction"
          FileNames="CommandId.tt;CommandSet.tt;Constants.tt;CustomCmd.tt;Designer.tt;DocView.tt;DslEditorsResx.tt;Editors.tt;Package.tt;ToolWindow.tt">
    <Input Name="FolderPath" RecipeArgument="GeneratedCodeFolderPath" />
    <Input Name="ReferringProject" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="TraceCleanup33" Type="WriteTraceAction" Pane="Package" Message="Removing added files from folder: '$(ResourcesFolderPath)'"/>
  <Action Name="CleanupResourcesFolderPath" Type="DeleteProjectItemsAction"
          FileNames="DslEditorsToolWindowBitmaps.bmp;ExampleEditorBitmap1.bmp;ExampleEditorBitmap2.bmp;ExampleEditorBitmap3.bmp">
    <Input Name="FolderPath" RecipeArgument="ResourcesFolderPath" />
    <Input Name="ReferringProject" RecipeArgument="DslPackageProject" />
  </Action>
  
  <!-- Remove empty existing Destination Folders -->
  <Action Name="TraceCleanup41" Type="WriteTraceAction" Pane="Package" Message="Removing folder (if empty): '$(ResourcesFolderPath)'"/>
  <Action Name="RemoveResourcesFolder" Type="DeleteEmptyProjectFolderAction">
    <Input Name="FolderPath" RecipeArgument="ResourcesFolderPath" />
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="TraceCleanup42" Type="WriteTraceAction" Pane="Package" Message="Removing folder (if empty): '$(GeneratedCodeFolderPath)'"/>
  <Action Name="RemoveGeneratedCodeFolder" Type="DeleteEmptyProjectFolderAction">
    <Input Name="FolderPath" RecipeArgument="GeneratedCodeFolderPath" />
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="TraceCleanup43" Type="WriteTraceAction" Pane="Package" Message="Removing folder (if empty): '$(FullDestFolderPath)'"/>
  <Action Name="RemoveDestFolder" Type="DeleteEmptyProjectFolderAction">
    <Input Name="FolderPath" RecipeArgument="FullDestFolderPath" />
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>

  <!--Remove added INCLUDE AND MACROS from Commands.ctc file -->
  <Action Name="TraceCleanup51" Type="WriteTraceAction" Pane="Package" Message="Removing #include statement from CTC file"/>
  <Action Name="RemoveHeaderInclude" Type="RemoveLineFromTextFileAction"
      SearchExpression="\#include &quot;\.\.\\$(GeneratedCodeFolderPath)\\CustomCmd\.h&quot;">
    <Input Name="TargetFilePath" RecipeArgument="CtcFilePath" />
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="TraceCleanup52" Type="WriteTraceAction" Pane="Package" Message="Removing macros declarations from CTC file"/>
  <Action Name="RemoveGroupsMacro" Type="RemoveLineFromTextFileAction"
      SearchExpression="DSLEDITORPOWERTOY_GROUPS">
    <Input Name="TargetFilePath" RecipeArgument="CtcFilePath" />
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="RemoveButtonMacro" Type="RemoveLineFromTextFileAction"
      SearchExpression="DSLEDITORPOWERTOY_BUTTONS">
    <Input Name="TargetFilePath" RecipeArgument="CtcFilePath" />
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="RemoveCommandPlacementMacro" Type="RemoveLineFromTextFileAction"
      SearchExpression="DSLEDITORPOWERTOY_CMDPLACEMENT">
    <Input Name="TargetFilePath" RecipeArgument="CtcFilePath" />
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  
  <!-- Remove Configuration Info -->
  <Action Name="TraceCleanup61" Type="WriteTraceAction" Pane="Package" Message="Removing project marking"/>
  <Action Name="UnmarkAsPowerToyProject" Type="DeleteProjectGlobalsEntryAction"
      PropertyName="DSLPowerEditorToyEditor">
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="TraceCleanup62" Type="WriteTraceAction" Pane="Package" Message="Removing saved configuration"/>
  <Action Name="RemoveDestFolderPath" Type="DeleteProjectGlobalsEntryAction"
      PropertyName="DSLPowerEditorToyEditor_AddedFolder">
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
  <Action Name="RemoveCtcFileLocation" Type="DeleteProjectGlobalsEntryAction"
      PropertyName="DSLPowerEditorToyEditor_CtcFile">
    <Input Name="Project" RecipeArgument="DslPackageProject" />
  </Action>
</Actions>